package qing.service;

import java.util.List;

import javax.annotation.Resource;

import org.hibernate.Query;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import qing.dao.IDao;

@Service
public class ServiceImpl<T> implements IService<T> {

	@Autowired
	private IDao<T> idao;

	@Override
	public T find(Class<T> class1, int id) {
		return idao.find(class1, id);
	}

	@Override
	public void create(T bean) {
		idao.create(bean);
	}

	@Override
	public void update(T bean) {
		idao.update(bean);
	}

	@Override
	public void delete(T bean) {
		idao.delete(bean);
	}

	@Override
	public void delete(Class<T> class1, int id) {
		idao.delete(class1, id);
	}

	@Override
	public List<T> list(String hql) {
		return idao.list(hql);
	}

	@Override
	public List<T> list(String hql, Object[] objects) {
		return idao.list(hql, objects);
	}

	@Override
	public int getTotalCount(String hql, Object... objects) {
		return idao.getTotalCount(hql, objects);
	}

	@Override
	public List<T> list(String hql, int firstResult, int maxSize, Object... objects) {
		return idao.list(hql, firstResult, maxSize, objects);
	}

	@Override
	public Query createQuery(String hql) {
		return idao.createQuery(hql);
	}

}
